/**
 * 区域管理
 * @author luguoxiang
 * @date 2023-03-27
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { IConfigSchema, LgBizTree, LgBizTreeProps } from '@/soar';
import api from './api';

const strs = ['000000', '00000', '0000', '000', '00', '0', ''];

function getParentId(id: string) {
  if (id.length > 6) {
    id = id.substring(0, 6);
  }
  const v = Number(id + strs[id.length]);
  if (v % 10000 === 0) {
    return 0;
  }
  if (v % 100 === 0) {
    return Math.floor(v / 10000) * 10000;
  }
  return Math.floor(v / 100) * 100;
}

const fieldList: IConfigSchema<any>[] = [
  {
    field: 'id',
    label: 'ID',
    dataType: 'string',
    form: {
      rules: true,
      componentProps: {
        maxlength: 6,
      },
    },
  },
  {
    field: 'name',
    label: '名称',
    dataType: 'string',
    form: {
      rules: true,
    },
  },
  {
    field: 'status',
    label: '是否禁用',
    dataType: 'boolean',
  },
  {
    field: 'sort',
    label: '排序',
    dataType: 'number',
  },
];

export default fieldList;
